jsx3.Class.defineClass(
		"tibco.admin.monitormanage.uicomponents.text.machineInfo.MachineInfo", //the full name of the class to create
		jsx3.gui.Block, //  extends
		null, // implements
		function (plugin)
		{

			plugin.prototype.init = function()
			{
				this.jsxsuper();
			}

			plugin.prototype.setUpComponent = function()
			{
				var subject = tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.machineInfoCacheSubject;
				tibco.admin.monitormanage.general.PageBusUtils.subscribe(subject, this.handleDisplayScreen, this);
			}

			plugin.prototype.handleDisplayScreen = function(subject, message, infoObj)
			{
				infoObj.loadContent(infoObj);
			}

			plugin.prototype.loadContent = function(infoObj)
			{
				var server = tibco.admin.Main.getServer();
				var machineInfoDoc = server.Cache.getDocument(tibco.admin.monitormanage.uicomponents.page.gridInfrastructure.GridInfrastructure.machineScreenCacheId);
				if (machineInfoDoc)
				{
					var record = machineInfoDoc.getFirstChild();

					var nameField = infoObj.getDescendantOfName("machineInfoName_MM_infra");
					nameField.setText(record.getAttribute("name"));
					nameField.repaint();

					var osField = infoObj.getDescendantOfName("machineInfoOS_MM_infra");
					osField.setText(record.getAttribute("OS"));
					osField.repaint();

					var tibcoHomeField = infoObj.getDescendantOfName("machineInfoTibcoHome_MM_infra");
					tibcoHomeField.setText(record.getAttribute("tibHome"));
					tibcoHomeField.repaint();

					var memoryField = infoObj.getDescendantOfName("machineInfoMemory_MM_infra");
					var memoryVal = (record.getAttribute("memoryInUse") / record.getAttribute("totalMemory")) * 100;

					if (memoryVal <= 50)
					{
						progressFill = server.resolveURI('jsxaddin://user!MatrixAdmin/images/matrix/progressBarGreenFill.jpg');
					}
					else if (memoryVal <= 75)
					{
						progressFill = server.resolveURI('jsxaddin://user!MatrixAdmin/images/matrix/progressBarYellowFill.jpg');
					}
					else
					{
						progressFill = server.resolveURI('jsxaddin://user!MatrixAdmin/images/matrix/progressBarRedFill.jpg');
					}
					var backgroundImg = server.resolveURI('jsxaddin://user!MatrixAdmin/images/matrix/progressBarBkgrdTile.jpg');
					var memoryText = "<div style=\"float:left;width:100;border-left:1px solid #626262;border-right:1px solid #626262;background-image:url(" + backgroundImg + ");\"><div style=\"width:" + memoryVal + ";background-image:url(" + progressFill + ");height:10px;\"></div></div>";
					memoryText += "<div style=\"float:left;margin-left:5px;\">" + (record.getAttribute("memoryInUse") || 0) + "MB/" + (record.getAttribute("totalMemory") || 0) + "MB</div>";
					memoryField.setText(memoryText);
					memoryField.repaint();

					var statusField = infoObj.getDescendantOfName("machineInfoStatus_MM_infra");
					statusField.setText(record.getAttribute("status"));
					statusField.repaint();
				}
			}

		});